package test;

import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.net.InetAddress;

public class SocketInternet {
    @Test
    public void testInetAddress() throws IOException {
        InetAddress ip = InetAddress.getByName("www.baidu.com");
        System.out.println("ip.isReachable(2000) = " + ip.isReachable(5000));
        System.out.println("ip.getHostAddress() = " + ip.getHostAddress());
    
        InetAddress local = InetAddress.getByAddress(new byte[]{127, 0, 0, 1});
        System.out.println("local.isReachable(2000) = " + local.isReachable(2000));
    }
    
    
}
